/*
   @Copyright:LeetCode
   @Author:   tjyemail
   @Problem:  http://leetcode.com/problems/jump-game
   @Language: C++
   @Datetime: 19-06-19 14:29
   */

class Solution {
public:
	bool canJump(vector<int>& nums) {
		for(int i=0, maxpos=0; i<nums.size(); ++i){
			if(i>maxpos) return false;
			maxpos=max(maxpos,i+nums[i]);
		}
		return true;
	}
};
